package Test;

import java.util.Scanner;

public class test09 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();//怪物数量
        int x = in.nextInt();//每次蛮牛践踏消耗的值
        int[] arr = new int[n];
        for(int i=0;i<n;i++) arr[i] = in.nextInt();
        long min = 0L;
        while(x<n){
            min+=x;
            for(int i=0;i<n;i++){
                if(arr[i]==0) n--;
                else{
                    arr[i]--;
                }
            }
        }
        for(int i=0;i<n;i++) min+=arr[i];
        System.out.println(min);
    }

}
